<?php

class FindFriendsForm extends CFormModel
{
	public $name;
	public $email;
	public $phone;
	public $love_category;
	public $love_author;

	public function attributeLabels()
	{
		return array(
			'name'		=> t('Name'),
			'phone'		=> t('Phone'),
			'email'		=> t('Email'),
			'love_category' => t('Category'),
			'love_author'	=> t('Author'),
		);
	}
	
	public function rules() {
		return array(
			array('name, phone, email, love_category, love_author', 'safe'),
			array('phone', 'length', 'min' => 3),
		);
	}
	
	public function findFriends($number = 20, $page = 1) {
		$suggested = Friend::findFriends(user()->id, $this->attributes, $number, $page);
		
		return $suggested;		
	}

}
